let api_config = {
	list: {
		url: "",
		action: 'product_getList',
		method: "get"
	},
	add: {
		url: "",
		action: "product_save",
		method: "get"
	},
	edit: {
		url: "",
		action: "product_save",
		method: "get",
		id_field: "id",
		// is_query_detail: false
	},
	delete: {
		url: "",
		action: "product_delProduct",
		method: "get",
		id_field: "id",
	},
	detail: {
		url: "",
		action: "product_info",
		method: "get",
		id_field: "id",
	},
}


let column_params = {
	"id": "",
	"title": "",
	"subtitle": "",
	"brandId": "",
	"channelId": "",
	"ordering": "",
	"units": "",
	"keywords": "",
	"tags": "",
	"thumb": "",
	"pr_pdf_url": "",
	"videoImg": "",
	"videoUrl": "",
	"cont1": "",
	"cont2": "",
	"cont3": "",
	"yunfeiMoban": "",
	"description": "",
	"shareImg": "",
	"isTuan": "",
	"tuanNum": "",
	"inventorys": "",
	// 新增
	"sizeId": "",
	"coatingId": "",
	"materialId": "",
	"thicknessId": "",
}


let columns = [{
	"sort_in_form": "",
	"field": "id",
	"field_title": "ID",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "input",
	"is_hidden_in_table": false,
	"is_hidden_in_form": true,
	"is_required_in_form": false
}, {
	"sort_in_form": "",
	"field": "title",
	"field_title": "商品名称",
	"table_width": "250",
	"table_render_type": "text",
	"form_render_type": "input",
	"is_hidden_in_table": false,
	"is_hidden_in_form": false,
	"is_required_in_form": true
},
// {
// 	"sort_in_form": "",
// 	"field": "thumb",
// 	"field_title": "列表缩略图",
// 	"table_width": "auto",
// 	"table_render_type": "image",
// 	"form_render_type": "image",
// 	"is_hidden_in_table": false,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// },
{
	"sort_in_form": "",
	"field": "images",
	"field_title": "列表缩略图(600*600)",
	"table_width": "auto",
	"table_render_type": "image-list",
	"form_render_type": "image-list",
	"is_hidden_in_table": false,
	"is_hidden_in_form": false,
	"is_required_in_form": false
},
{
	"sort_in_form": "",
	"field": "channelId",
	"field_title": "分类",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "treeSelect",
	"is_hidden_in_table": false,
	"is_hidden_in_form": false,
	"is_required_in_form": false
},
// {
// 	"sort_in_form": "",
// 	"field": "productType",
// 	"field_title": "商品类型",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "radio",
// 	"is_hidden_in_table": false,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// },
//  {
// 	"sort_in_form": "",
// 	"field": "sizeId",
// 	"field_title": "商品尺寸",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "select",
// 	"is_hidden_in_table": false,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// }, {
// 	"sort_in_form": "",
// 	"field": "coatingId",
// 	"field_title": "商品镀膜",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "select",
// 	"is_hidden_in_table": false,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// }, {
// 	"sort_in_form": "",
// 	"field": "materialId",
// 	"field_title": "商品材料",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "select",
// 	"is_hidden_in_table": false,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// }, {
// 	"sort_in_form": "",
// 	"field": "thicknessId",
// 	"field_title": "商品厚度",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "select",
// 	"is_hidden_in_table": false,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// }, 
{
	"sort_in_form": "",
	"field": "channelTitle",
	"field_title": "分类标题",
	"table_width": "250",
	"table_render_type": "text",
	"form_render_type": "input",
	"is_hidden_in_table": false,
	"is_hidden_in_form": true,
	"is_required_in_form": false
},
{
	"sort_in_form": "",
	"field": "news",
	"field_title": "相关资讯",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "select",
	"is_hidden_in_table": false,
	"is_hidden_in_form": false,
	"is_required_in_form": false
}, {
	"sort_in_form": "",
	"field": "ordering",
	"field_title": "排序",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "input",
	"is_hidden_in_table": false,
	"is_hidden_in_form": false,
	"is_required_in_form": false
},
//  {
// 	"sort_in_form": "",
// 	"field": "keywords",
// 	"field_title": "关键词",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "input",
// 	"is_hidden_in_table": false,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// },
{
	"sort_in_form": "",
	"field": "tags",
	"field_title": "标签",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "select",
	"is_hidden_in_table": false,
	"is_hidden_in_form": false,
	"is_required_in_form": false
}, {
	"sort_in_form": "",
	"field": "pr_pdf_url",
	"field_title": "文件",
	"table_width": "auto",
	"table_render_type": "file",
	"form_render_type": "file",
	"is_hidden_in_table": true,
	"is_hidden_in_form": true,
	"is_required_in_form": false
}, {
	"sort_in_form": "",
	"field": "videoImg",
	"field_title": "视频主图",
	"table_width": "auto",
	"table_render_type": "image",
	"form_render_type": "image",
	"is_hidden_in_table": true,
	"is_hidden_in_form": false,
	"is_required_in_form": false
}, {
	"sort_in_form": "",
	"field": "videoUrl",
	"field_title": "视频",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "upload-video",
	"is_hidden_in_table": false,
	"is_hidden_in_form": false,
	"is_required_in_form": false
}, {
	"sort_in_form": "",
	"field": "cont1",
	"field_title": "详情描述",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "richtext",
	"is_hidden_in_table": true,
	"is_hidden_in_form": false,
	"is_required_in_form": false
}, {
	"sort_in_form": "",
	"field": "cont3",
	"field_title": "相关资讯",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "richtext",
	"is_hidden_in_table": true,
	"is_hidden_in_form": false,
	"is_required_in_form": false
}, {
	"sort_in_form": "",
	"field": "yunfeiMoban",
	"field_title": "运费模板",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "select",
	"is_hidden_in_table": true,
	"is_hidden_in_form": false,
	"is_required_in_form": false
},
// {
// 	"sort_in_form": "",
// 	"field": "description",
// 	"field_title": "商品简介",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "textarea",
// 	"is_hidden_in_table": true,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// }, {
// 	"sort_in_form": "",
// 	"field": "shareImg",
// 	"field_title": "商品分享图",
// 	"table_width": "auto",
// 	"table_render_type": "image",
// 	"form_render_type": "image",
// 	"is_hidden_in_table": true,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// }, {
// 	"sort_in_form": "",
// 	"field": "isTuan",
// 	"field_title": "是否拼团",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "radio",
// 	"is_hidden_in_table": true,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// }, {
// 	"sort_in_form": "",
// 	"field": "tuanNum",
// 	"field_title": "拼团人数",
// 	"table_width": "auto",
// 	"table_render_type": "text",
// 	"form_render_type": "input",
// 	"is_hidden_in_table": true,
// 	"is_hidden_in_form": false,
// 	"is_required_in_form": false
// }, 
{
	"sort_in_form": "",
	"field": "status",
	"field_title": "上架状态",
	"table_width": "auto",
	"table_render_type": "tag",
	"form_render_type": "radio",
	"is_hidden_in_table": false,
	"is_hidden_in_form": false,
	"is_required_in_form": false
}, 
{
	"sort_in_form": "",
	"field": "inventorys",
	"field_title": "规格参数",
	"table_width": "auto",
	"table_render_type": "text",
	"form_render_type": "input",
	"is_hidden_in_table": true,
	"is_hidden_in_form": true,
	"is_required_in_form": false
}]

let table_columns = columns.filter(v => !v.is_hidden_in_table).map(v => ({
	...v
}))
// [
//     // {
//     //     column: "postId",//字段属性名
//     //     field_title: "ID", //字段标题
//     //     table_width: "auto",//表格宽度
//     //     column_sortable: false, //表格是否可排序
//     //     column_show_overflow_tooltip: false, //表格悬浮是否展示提示
//     //     table_render_type: '',//表格展示类型   '' || text || tag || image || image-list || file
//     // },
// ]

let form_fields = columns.filter(v => !v.is_hidden_in_form).map(v => ({
	...v
}))

// 表单默认值
let form_fields_default_value = {
	// "id": "",
	// "title": "",
	// "subtitle": "",
	// "brandId": "",
	// "channelId": "",
	// "ordering": "",
	// "units": "",
	// "keywords": "",
	// "tags": "",
	// "thumb": "",
	// "videoImg": "",
	// "videoUrl": "",
	// "cont1": "",
	// "cont2": "",
	// "cont3": "",
	// "yunfeiMoban": "",
	// "description": "",
	// "shareImg": "",
	"isTuan": 0,
	"status": 1,
	// "tuanNum": "",
	// "inventorys": "",
	// "sizeId": "",
	// "coatingId": "",
	// "materialId": "",
	// "thicknessId": "",
	"productType": 1
}

// [
//     //【form_render_type 类型列表】
//     //input 默认
//     //number 文字输入
//     //textarea 文本域
//     //date 日期
//     //select 下拉选
//     //radio 单选
//     //cascader 级联选择
//     //upload-image 上传图片
//     //upload-file 上传文件
//     //rich-editor 富文本编辑器
//     //topic-card 话题卡片
//     {
//         column: "postId",
//         field_title: "ID",
//         is_required: 1,
//         form_render_type: "ID", //'' || text || tag || image || image-list || file
//         //选项型数据
//         // labelKey: "channelName",
//         // valueKey: "channelId",
//         // options: newsTypeOptions,

//         // 文件上传
//         // upload_multiple: true,
//         // upload_limit: 9,
//         // upload_tip: "(可上传多图，建议图片压缩后上传)",
//         // cache_key: "upload_cover_list", //图片上传回显
//         // saveFormat: "jsonObjectArray",
//     },
// ]


// console.log('字段配置 columns', JSON.parse(JSON.stringify(columns)))
console.log('表格配置 table_columns', JSON.parse(JSON.stringify(table_columns)))
console.log('表单配置 form_fields', JSON.parse(JSON.stringify(form_fields)))

// console.log('字段配置 columns', (JSON.stringify(columns)))
// console.log('表格配置 table_columns', (JSON.stringify(table_columns)))
// console.log('表单配置 form_fields', (JSON.stringify(form_fields)))




let table_row_actions = [{
	title: '修改',
},
{
	title: '删除',
},

]



let radio_options_map = {
	isTuan: [{
		title: '否',
		value: 0,
		type: '',
	},
	{
		title: '是',
		value: 1,
		type: 'info',
	}],
	status: [{
		title: '上架',
		value: 1,
		type: '',
	},
	{
		title: '下架',
		value: -1,
		type: 'info',
	}],
	productType: [
		{
			title: '基础商品',
			value: 1,
			type: '',
		},
		{
			title: '选配商品',
			value: 2,
			type: '',
		},
		{
			title: '配件商品',
			value: 3,
			type: '',
		},
	]
}


let select_config_map = {
	'tags': {
		options: [],
		labelKey: 'title',
		valueKey: 'title',
	},
	'yunfeiMoban': {
		api: {
			url: '/admin_service.php',
			method: 'get',
			data: {
				action: 'yunfei_getList',
				page: 1,
				pageNum: 100,
			},
		},
		resHasPagination: true,
		options: [],
		labelKey: 'title',
		valueKey: 'id',
	},
	'sizeId': {
		api: {
			url: '/admin_service.php',
			method: 'get',
			data: {
				action: 'Productsize_getProductsizeList',
				page: 1,
				pageNum: 100,
			},
		},
		resHasPagination: true,
		options: [],
		labelKey: 'title',
		valueKey: 'id',
	},
	'coatingId': {
		api: {
			url: '/admin_service.php',
			method: 'get',
			data: {
				action: 'Productcoating_getProductcoatingList',
				page: 1,
				pageNum: 100,
			},
		},
		resHasPagination: true,
		options: [],
		labelKey: 'title',
		valueKey: 'id',
	},
	'materialId': {
		api: {
			url: '/admin_service.php',
			method: 'get',
			data: {
				action: 'Productmaterial_getProductmaterialList',
				page: 1,
				pageNum: 100,
			},
		},
		resHasPagination: true,
		options: [],
		labelKey: 'title',
		valueKey: 'id',
	},
	'thicknessId': {
		api: {
			url: '/admin_service.php',
			method: 'get',
			data: {
				action: 'Productthickness_getProductthicknessList',
				page: 1,
				pageNum: 100,
			},
		},
		resHasPagination: true,
		options: [],
		labelKey: 'title',
		valueKey: 'id',
	},
	'news': {
		api: {
			url: '/admin_service.php',
			method: 'get',
			data: {
				action: 'news_getNewList',
				page: 1,
				pageNum: 100,
			},
		},
		resHasPagination: true,
		options: [],
		labelKey: 'title',
		valueKey: 'id',
	},
}




let tree_config_map = {
	'channelId': {
		api: {
			url: '/admin_service.php',
			method: 'get',
			data: {
				action: 'product_getProductChannelList',
				page: 1,
				pageNum: 100,
				position: 0
			},
		},
		treeData: [],
		treeProps: {
			label: "title",
			children: "child",
		},
		treeShowCheckbox: false,
		treeNodeKey: "id",
		defaultExpandAll: true,
		titleKey: 'channelTitle',
		resHasPagination: true, //是否存在分页
	},
	// 'sizeId': {
	// 	api: {
	// 		url: '/admin_service.php',
	// 		method: 'get',
	// 		data: {
	// 			action: 'Productsize_getProductsizeList',
	// 			page: 1,
	// 			pageNum: 999,
	// 		},
	// 	},
	// 	treeData: [],
	// 	treeProps: {
	// 		label: "title",
	// 		children: "child",
	// 	},
	// 	treeShowCheckbox: false,
	// 	treeNodeKey: "sizeId",
	// 	defaultExpandAll: true,
	// 	titleKey: 'title',
	// 	resHasPagination: true, //是否存在分页
	// },
	// 'coatingId': {
	// 	api: {
	// 		url: '/admin_service.php',
	// 		method: 'get',
	// 		data: {
	// 			action: 'Productcoating_getProductcoatingList',
	// 			page: 1,
	// 			pageNum: 999,
	// 		},
	// 	},
	// 	treeData: [],
	// 	treeProps: {
	// 		label: "title",
	// 		children: "child",
	// 	},
	// 	treeShowCheckbox: false,
	// 	treeNodeKey: "coatingId",
	// 	defaultExpandAll: true,
	// 	titleKey: 'title',
	// 	resHasPagination: true, //是否存在分页
	// },
	// 'materialId': {
	// 	api: {
	// 		url: '/admin_service.php',
	// 		method: 'get',
	// 		data: {
	// 			action: 'Productmaterial_getProductmaterialList',
	// 			page: 1,
	// 			pageNum: 999,
	// 		},
	// 	},
	// 	treeData: [],
	// 	treeProps: {
	// 		label: "title",
	// 		children: "child",
	// 	},
	// 	treeShowCheckbox: false,
	// 	treeNodeKey: "materialId",
	// 	defaultExpandAll: true,
	// 	titleKey: 'title',
	// 	resHasPagination: true, //是否存在分页
	// },
	// 'thicknessId': {
	// 	api: {
	// 		url: '/admin_service.php',
	// 		method: 'get',
	// 		data: {
	// 			action: 'Productthickness_getProductthicknessList',
	// 			page: 1,
	// 			pageNum: 999,
	// 		},
	// 	},
	// 	treeData: [],
	// 	treeProps: {
	// 		label: "title",
	// 		children: "child",
	// 	},
	// 	treeShowCheckbox: false,
	// 	treeNodeKey: "thicknessId",
	// 	defaultExpandAll: true,
	// 	titleKey: 'title',
	// 	resHasPagination: true, //是否存在分页
	// }
}






// 上传配置
let upload_config_map = {
	'thumb': {
		multiple: false,
		limit: 1,
		tip: '请选择文件',
	},
	'videoImg': {
		multiple: false,
		limit: 1,
		tip: '请选择文件',
	},
	'shareImg': {
		multiple: false,
		limit: 1,
		tip: '请选择文件',
	},
	// 'pr_pdf_url': {
	// 	multiple: false,
	// 	limit: 100,
	// 	tip: '请选择文件',
	// },
	'images': {
		multiple: true,
		limit: 100,
		tip: '请选择文件',
	},
}


let form_field_multiple_map = {
	'tags': true,
	'news': true
}


export default {
	api_config,
	table_columns,
	form_fields,
	form_fields_default_value,
	table_row_actions,
	radio_options_map,
	select_config_map,
	upload_config_map,
	tree_config_map,
	form_field_multiple_map,
};